<?php
require_once $_site->get_viewpath("boss/common/authcheck");
require_once $_site->get_viewpath("mobile/common/header");

$id=request('id',false,true);

$boss_objet=new boss();
$wjinfo=$boss_objet->_car_info($id);
$now_time=time();
if(empty($wjinfo) || ($wjinfo['uid']!=$boss_id))return false;

$cond['uid']=$boss_id;
$cond['carid']=$id;
$page=request('page',false,true,false,1);
$list=$boss_objet->cash_search($cond,$page);

if($list)$first=$list['rows'][0];
?>	
</head>

	<body>
		<div class="headertwo clearfloat" id="header">
			<a href="/boss/car" class="fl box-s"><i class="iconfont icon-arrow-l fl"></i></a>
			<p class="fl">设备充值</p>
			<a href="/boss/center" class="fr"><i class="iconfont icon-gerenzhongxin fl"></i></a>
		</div>
		
		<?php 
		   if(empty($first) || $first['state']==1){
		?>
		<div class="recharge clearfloat" id="main">
    		<form action="/handle.php" method="post" id="form1">
    		<input type="hidden" name="h" value="boss/cash">
    		<input type="hidden" name="did" value="<?php echo $id ?>">
    		<div class="addlist clearfloat">
    			<div class="bottom clearfloat box-s">
	    			<section class="shopcar clearfloat">
						<div class="shopcar-checkbox fr">
							<label>
							<input type="radio" name="ptype" value="1"/>
							<div class="option"></div>
							</label>
						</div>
						<div class="sorder-list clearfloat fl">
							<i class="iconfont icon-yinxingqia yinxinqia fl"></i>
							<div class="zuo fl">
								<p class="tit">套餐一</p>
								<p class="fu-tit">每月（30天）</p>
							</div>							
						</div>
					</section>
	    		</div>
	    		
	    		<div class="bottom clearfloat box-s">
	    			<section class="shopcar clearfloat">
						<div class="shopcar-checkbox fr">
							<label>
							<input type="radio" name="ptype" value="2" checked/>
							<div class="option"></div>
							</label>
						</div>
						<div class="sorder-list clearfloat fl">
							<i class="iconfont icon-yinxingqia yinxinqia fl"></i>
							<div class="zuo fl">
								<p class="tit">套餐二</p>
								<p class="fu-tit">一季度（90天）</p>
							</div>							
						</div>
					</section>
	    		</div>
	    		
	    		<div class="bottom clearfloat box-s">
	    			<section class="shopcar clearfloat">
						<div class="shopcar-checkbox fr">
							<label>
							<input type="radio" name="ptype" value="3"/>
							<div class="option"></div>
							</label>
						</div>
						<div class="sorder-list clearfloat fl">
							<i class="iconfont icon-yinxingqia yinxinqia fl"></i>
							<div class="zuo fl">
								<p class="tit">套餐三</p>
								<p class="fu-tit">半年（183天）</p>
							</div>							
						</div>
					</section>
	    		</div>
				
	    		<div class="bottom clearfloat box-s">
	    			<section class="shopcar clearfloat">
						<div class="shopcar-checkbox fr">
							<label>
							<input type="radio" name="ptype" value="4"/>
							<div class="option"></div>
							</label>
						</div>
						<div class="sorder-list clearfloat fl">
							<i class="iconfont icon-yinxingqia yinxinqia fl"></i>
							<div class="zuo fl">
								<p class="tit">套餐四</p>
								<p class="fu-tit">每年（365天）</p>
							</div>							
						</div>
					</section>
	    		</div>				
	    	</div>
			</form>

		<a href="javascript:;" onclick="ajaxpostconfirm('form1','是否提交充值信息？');" class="pay-btn clearfloat">确认充值</a>
		
		</div>
		<?php } ?>
		
		<div class="clearfloat" id="main">		
			
			<?php 
			   if($first && $first['state']==0){
			?>
			<div class="service-top clearfloat box-s">
				<div class="left fl clearfloat box-s">
					<p class="tit titwo"><?php echo $first['money']?><span>元 (确认处理中)</span></p>
					<p class="fu-tit">提交时间：<?php echo date('Y-m-d H:i:s',$first['time']);?></p>
				</div>
				<div class="right fl clearfloat">
				<a href="javascript:;" onclick="ajaxget('/handle.php?h=boss/delcash&id=<?php echo $first['id']?>','是否删除充值申请？')">
					<i class="iconfont icon-shoucang"></i>
					<p>删除</p>
				</a>	
				</div>
			</div>
			<?php } ?>
			
			<div class="service-ctent clearfloat">
				<div class="recom-tit clearfloat box-s">
		    		<p>车辆信息</p>
		    	</div>
		    	<div class="service-list clearfloat box-s">
		    		<ul>
		    			<li>车型：<?php echo $wjinfo['car'];?></li>
		    			<li>车牌：<?php echo $wjinfo['carno'];?></li>
		    			<li>设备号：<?php echo $wjinfo['code'];?> </li>
		    			<li>截止时间：<?php echo $wjinfo['endtime']>0?($wjinfo['endtime']>$now_time?date('Y-m-d H:i:s',$wjinfo['endtime']):"<font color='red'>".date('Y-m-d H:i:s',$wjinfo['endtime'])."</font>"):'';?></li>		    			
		    		</ul>		    		
		    	</div>		    	
			</div>
			
						
			<div class="service-ctent clearfloat">
				<div class="recom-tit clearfloat box-s">
		    		<p>充值记录</p>
		    	</div>
		    	<table border="0" class="clearfloat">
		    		<tbody><tr>
		    			<th>充值时间</th>
		    			<th>金额</th>
		    			<th>延长时间</th>
		    		</tr>
		    		<?php 
		    		   if($list['rows']){
                         foreach($list['rows'] as $val){
		    		?>
		    		<tr>
		    			<td><?php echo date('Y-m-d H:i:s',$val['time'])?></td>
		    			<td>￥ <?php echo $val['money'];?></td>
		    			<td><?php echo $val['length']/86400;?>天</td>
		    		</tr>
		    		<?php 
		    		  }}
		    		?>
		    		
		    	</tbody></table>
			</div>
			
		</div>

	</body>	

</html>